package jp.co.ricoh.melody.models;

import jp.co.ricoh.melody.databases.DBManager;
import jp.co.ricoh.melody.models.entities.AlarmData;

/**
 * Copyright (C) 2016 RICOH Co.,LTD.
 * All rights reserved.
 * Model Class of Add/Edit Alarm Screen.
 */
public class AddAlarmActivityModel implements IAddAlarmActivityModel {

    private final IDayListModel mModel = new DayListModel();
    private DBManager mDatabaseManager = DBManager.getInstance();


    /**
     * compare oldAlarm with newAlarm
     *
     * @param oldAlarm
     * @param newAlarm
     * @return
     */
    @Override
    public boolean isAlarmChanged(AlarmData oldAlarm, AlarmData newAlarm) {
        return oldAlarm.compare(newAlarm);
    }

    @Override
    public AlarmData getAlarmById(int id) {
        return mDatabaseManager.getAlarmById(id);
    }

    @Override
    public void addAlarm(AlarmData alarm, DBManager.OnSaveDataResultListener onSaveDataResultListener) {
        mDatabaseManager.addAlarm(alarm, onSaveDataResultListener);
    }

    @Override
    public void editAlarm(AlarmData newAlarm, DBManager.OnSaveDataResultListener onSaveDataResultListener) {
        mDatabaseManager.editAlarm(newAlarm, onSaveDataResultListener);
    }

    @Override
    public boolean validateAlarm(AlarmData alarm) {
        return mDatabaseManager.validateAlarm(alarm);
    }
}
